﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZF.BLL;
using GCELibrary.Current;

namespace ZF.WS.Admin
{
    public partial class Login :BLL.Page.LoginPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

#if(l)
            if (SiteInfo.IsLocal)
            {
                this.tbAccount.Text = "ajy168";
                this.tbPwd.Attributes["value"] = "tj2010";
            }
#endif


        }

        private void _login(string account, string pwd)
        {
            var gate = new BLL.Gate.ManageGate();

            if (!string.IsNullOrEmpty(this.from))
            {
                gate.DefaultPage = this.from;
            }
            gate.Login(this.tbAccount.Text.Trim(), this.tbPwd.Text, this.cbRemember.Checked ? 30 : -1);
        }
        protected void _Login(object sender, EventArgs e)
        {

#if(l)
            _login(this.tbAccount.Text.Trim(), this.tbPwd.Text);
            return;
#endif


            if (SiteInfo.ValidateCode(this.tbVCode.Text))
            {
                _login(this.tbAccount.Text.Trim(), this.tbPwd.Text);
            }
            else
            {
                WarnFactory.CreateWarn(new GCELibrary.Current.PageWarnParameter()
                {

                    JscriptMode = true,
                    Message = "验证码错误",
                    Link = WarnLink.GoBack,
                }).Alert();
            }

          
        }
    }
}
